//
//  LYQMainTabBarController.m
//  ZCProject
//
//  Created by Zheng on 16/10/30.
//  Copyright © 2016年 Zheng. All rights reserved.
//

#import "LYQMainTabBarController.h"
#import "LYQHomeNavigationController.h"
#import "LYQHomeViewController.h"
#import "LYQFoundViewController.h"
#import "LYQBaseBlueNavigationController.h"
#import "LYQMineViewController.h"
#import "LYQTopicListViewController.h"

@interface LYQMainTabBarController ()

@property (nonatomic, strong) NSMutableArray *rViewControllersArr;
@property (nonatomic, strong) NSArray *nImagesNameArr;
@property (nonatomic, strong) NSArray *sImagesNameArr;

@end

@implementation LYQMainTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    if (!_rViewControllersArr) {
        _rViewControllersArr = [[NSMutableArray alloc] init];
        
        if (!_nImagesNameArr) {
            _nImagesNameArr = @[@"syicon",
                                @"hticon",
                                @"fxicon",
                                @"xxicon",
                                @"wdicon"];
        }
        
        if (!_sImagesNameArr) {
            _sImagesNameArr = @[@"syiconhight",
                                @"hticonhight",
                                @"fxiconhight",
                                @"xxiconhight",
                                @"wdiconhight"];
        }
        
        for (int i = 0; i < 5; i++) {
            
            if (i == 2) {
                LYQFoundViewController *fvc = [[LYQFoundViewController alloc] init];
                UINavigationController *ssnc = [[UINavigationController alloc] initWithRootViewController:fvc];
                [_rViewControllersArr addObject:ssnc];
            } else if (i == 1) {
                LYQTopicListViewController *tlVC = [[LYQTopicListViewController alloc] init];
                LYQBaseBlueNavigationController *bbnc = [[LYQBaseBlueNavigationController alloc] initWithRootViewController:tlVC];
                [_rViewControllersArr addObject:bbnc];
            }
            
            else if (i == 4) {
                LYQMineViewController *mvc = [[LYQMineViewController alloc] init];
                LYQBaseBlueNavigationController *bbnc = [[LYQBaseBlueNavigationController alloc] initWithRootViewController:mvc];
                [_rViewControllersArr addObject:bbnc];
            }
            
            else {
                LYQHomeViewController *hvc = [[LYQHomeViewController alloc] init];
                LYQHomeNavigationController *hnc = [[LYQHomeNavigationController alloc] initWithRootViewController:hvc];
                [_rViewControllersArr addObject:hnc];

            }
            
        }
        
        for (int i = 0; i <  5; i++) {
            UIImage *imageNormal = [[UIImage imageNamed:_nImagesNameArr[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
            UIImage *imagePress = [[UIImage imageNamed:_sImagesNameArr[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
            
            LYQBaseListViewController *vc = (LYQBaseListViewController *)_rViewControllersArr[i];
            vc.tabBarItem = [[UITabBarItem alloc] initWithTitle:nil image:imageNormal selectedImage:imagePress];
            vc.tabBarItem.imageInsets = UIEdgeInsetsMake(7, 0, -7, 0);
        }
        
        self.viewControllers = _rViewControllersArr;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
